import TUIChat from "./TUIChat";
import TUIConversation from "./TUIConversation";
import TUISearch from "./TUISearch";
import TUIContact from "./TUIContact";
import TUIGroup from "./TUIGroup";
import { yingyaoHttps } from '@/common/util.js'
const TUIComponents = {
  TUIChat,
  TUIConversation,
  TUIContact,
  TUISearch,
  TUIGroup
};

export default TUIComponents;
function zxbAjax(url, data, fun){
  uni.request({
    url:yingyaoHttps()+url,
    data: data,
    method:'POST',
    header: {
      'token': uni.getStorageSync('token') //自定义请求头信息
    },
    success: (res) => {
      if(res.data.code === 1){
        fun(res.data.data)
      }else if(res.data.code === 401){
        uni.navigateTo({
          url:'/pages/my/my'
        })
      }
        // console.log('zxbAjax',res.data);
    }
  })
}
function zxbAjaxGet(url, data, fun){
  uni.request({
    url:yingyaoHttps()+url,
    data: data,
    method:'GET',
    header: {
      'token': uni.getStorageSync('token') //自定义请求头信息
    },
    success: (res) => {
      if(res.data.code === 1){
        fun(res.data.data)
      }
        // console.log('zxbAjax',res.data);
    }
  })
}
export {
  TUIChat,
  TUIConversation,
  TUIContact,
  TUISearch,
  TUIGroup,
  zxbAjax,
  zxbAjaxGet
};
